<template>
	<view class="page">
	  <view class="plan-list" v-if="useBrands != ''">
	    <view class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">车辆信息</view>
	        <view class="item-right" style="color: #595959" :data-data="1" @click="carSelect">{{useBrands.brandName}} {{useBrands.seriesName}} {{useBrands.carTypeName}}</view>
	      </view>
	    </view>
	  </view>
	  <view class="plan-list" v-else-if="gouchedaiData.carId != ''">
	    <view class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">车辆信息</view>
	        <view class="item-right" style="color: #595959" :data-data="1" @click="carSelect">{{gouchedaiData.brandName}} {{gouchedaiData.carTypeName}} {{gouchedaiData.carName}}</view>
	      </view>
	    </view>
	  </view>
	  <view class="plan-list" v-else>
	    <view class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">车辆信息</view>
	        <view class="item-right" :style="useBrands == '' ? 'color: #959595' : 'color: #595959'" @click="carSelect">请选择品牌车系车型</view>
	      </view>
	    </view>
	  </view>
	  <view class="plan-list">
	    <view class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">是否新能源</view>
					<picker class="item-right" :style="isEvText == '请选择是否为新能源车型' ? 'color: #959595' : 'color: #595959'"
					 @change="isEvSelect" :value="isEvIndex" :range="isEvList">
						<view class="uni-input">{{isEvText}}</view>
					</picker>
	      </view>
	    </view>
			<view class="list-item">
				<view class="item-left">成交金额</view>
				<input type="number" placeholder-class="phcolor" data-name="cjje" @input="onInput" class="item-right" placeholder="请输入成交金额（元）" :value="cjje"/>
			</view>
	    <view v-if="gouchedaiData.biz_type == 9" class="list-item">
	      <view class="item-left">附加贷金额</view>
	      <input type="number" placeholder-class="phcolor" data-name="additionalAmt" @input="onInput" class="item-right" placeholder="请输入附加贷金额（元）" :value="additionalAmt"/>
	    </view>
	    <view v-if="gouchedaiData.biz_type == 9" class="list-item">
	      <view class="item-left">附加贷利率</view>
	      <input type="digit" placeholder-class="phcolor" data-name="additionalRate" @input="onInput" class="item-right" placeholder="请输入附加贷利率" :value="additionalRate"/>
	    </view>
	    <view class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">首付方式</view>
	        <picker class="item-right" :style="sffsText == '请选择首付方式' ? 'color: #959595' : 'color: #595959'"
	         @change="sffsSelect" :value="sffsIndex" :range="sffsList">
	        	<view class="uni-input">{{sffsText}}</view>
	        </picker>
	      </view>
	    </view>
	    <view v-if="sffsText == '按比例支付'" class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">首付比例</view>
	        <picker class="item-right" :style="sfblText == '请选择首付比例' ? 'color: #959595' : 'color: #595959'"
	         @change="sfblSelect" :value="sfblIndex" :range="downRatioList">
	        	<view class="uni-input">{{sfblText}}</view>
	        </picker>
	      </view>
	    </view>
	    <view v-if="sffsText == '按定额支付'" class="list-item">
				<view class="item-left">首付金额</view>
				<input type="number" placeholder-class="phcolor" data-name="sfje" @input="onInput" class="item-right" placeholder="请输入首付金额（元）" :value="sfje"/>
	    </view>
	    <view class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">贷款期数</view>
	        <picker class="item-right" :style="dkqsText == '请选择贷款期数' ? 'color: #959595' : 'color: #595959'"
	         @change="dkqsSelect" :value="dkqsIndex" :range="periodsList">
	        	<view class="uni-input">{{dkqsText}}</view>
	        </picker>
	      </view>
	    </view>
	    <block v-if="gouchedaiData.biz_type == 7">
	    <view class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">是否贴息</view>
	        <view v-if="!useBrands.carTypeId || dkqsText == '请选择贷款期数'" class="item-right" style="color: #959595" @click="txShowToast">{{isTxText}}</view>
	        <picker v-else class="item-right" :style="isTxText == '请选择是否贴息' ? 'color: #959595' : 'color: #595959'"
	         @change="isTxSelect" :value="isTxIndex" :range="isTxList">
	        	<view class="uni-input">{{isTxText}}</view>
	        </picker>
	      </view>
	    </view>
	    <view :hidden="!showTxList" class="youjiantou">
	      <view class="list-item jt">
	        <view class="item-left">贴息方案</view>
	        <picker class="item-right" :style="txfaText == '请选择贴息方案' ? 'color: #959595' : 'color: #595959'"
	         @change="txfaSelect" :value="txfaIndex" :range="txfaList">
	        	<view class="uni-input">{{txfaText}}</view>
	        </picker>
	      </view>
	    </view>
	    </block>
	    <view class="list-item">
	      <view class="item-left">还款方式</view>
	      <view class="item-right">等额本息，按月还款</view>
	    </view>
	    <view class="list-item">
	      <view class="item-left">借款金额</view>
	      <view class="item-right">{{(jkamount*1).toFixed(2)}}</view>
	    </view>
	  </view>
	  <view class="prompt2">请确认以上信息无误后提交下一步！</view>
	  <view class="btnBox2">
	    <button class="btn" @click="navigateBack">取消修改</button>
	    <button class="btn" @click="nextBtn">确认修改并提交</button>
	  </view>
	</view>
</template>

<script>
	import {
	  getSchemeList, getCarDiscountinterest, createOrder
	} from '@/service/chengyongche'
	import {
	  imgUrl
	} from '@/service/config.js'
	let app = getApp();
	export default {
		data() {
			return {
				imgUrl: imgUrl,
				amount: '',
				isEvList: ["否", "是"],
				sffsList: ["按比例支付", "按定额支付"], 
				downRatioList: [], 
				periodsList: [],
				useBrands: '',
				isEvIndex: 0,
				isEvText: '请选择是否为新能源车型',
				sffsIndex: 0,
				sffsText: '请选择首付方式',
				sfblIndex: 0,
				sfblText: '请选择首付比例',
				dkqsIndex: 0,
				dkqsText: '请选择贷款期数',
				jkamount: '0',
				tocsgzt: false,
				cjje: '',
				sfje: '',
				isBtn: '',
				isTxList: ["否", "是"],
				isTxIndex: 0,
				isTxText: '请选择是否贴息',
				showTxList: false,
				txfaText: '请选择贴息方案',
				txfaIndex: 0,
				txfaList: [],
				isBack: false,
				additionalAmt: 0
			}
		},
		onLoad(e) {
			let gouchedaiData = {};
			let status = '';
			e.status ? status = e.status : status = '';
			status == 1 ? gouchedaiData = uni.getStorageSync('unfinished') : gouchedaiData = app.globalData.gouchedaiData;
			let isEvIndex = gouchedaiData.energy,
				isEvText = this.isEvList[gouchedaiData.energy],
				cjje = gouchedaiData.transaction_price,
				additionalRate = gouchedaiData.additionalRate,
				additionalAmt = gouchedaiData.additionalAmt,
				sffsText = gouchedaiData.down_method,
				sfje = gouchedaiData.down_amount,
				jkamount = gouchedaiData.loan_amount;
			let isTxText = gouchedaiData.discount_status;
			let isTxIndex = 0;
			let showTxList = false;
			let isTxList = this.isTxList;
			for(let i = 0; i < isTxList.length; i++) {
				console.log(isTxText == isTxList[i])
				if(isTxText == isTxList[i]) isTxIndex = i
			}
			isTxText == '是' ? showTxList = true : showTxList = false;
			let useBrands = {
				brandId: gouchedaiData.brandId,
				brandName: gouchedaiData.brand,
				seriesId: gouchedaiData.seriesId,
				seriesName: gouchedaiData.series,
				carImg: gouchedaiData.logo,
				carTypeId: gouchedaiData.vehicle_typeId,
				carTypeName: gouchedaiData.vehicle_type
			}
			let sffsList = this.sffsList;
			let sffsIndex = 0;
			for(let i = 0; i < sffsList.length; i++) {
				if(sffsList[i] == sffsText) {
					sffsIndex = i;
				}
			}
			let biz_type = gouchedaiData.biz_type;
			const enterpiseId = gouchedaiData.enterprise_id;
			let userInfoData = uni.getStorageSync('userInfo');
			let header = {
				'content-type': 'application/x-www-form-urlencoded',
				'Authorization': userInfoData.token
			};
			this.gouchedaiData = gouchedaiData;
			this.useBrands = useBrands; this.isEvIndex = isEvIndex; this.isEvText = isEvText; 
			this.cjje = cjje; this.additionalRate = additionalRate; this.additionalAmt = additionalAmt; 
			this.sffsIndex = sffsIndex; this.sffsText = sffsText; this.sfje = sfje; this.isTxText = isTxText; 
			this.isTxIndex = isTxIndex; this.showTxList = showTxList; this.jkamount = jkamount;
			this.userInfoData = userInfoData; this.enterpiseId = enterpiseId; this.header = header;
			let prams = {enterpriseId:enterpiseId,bizType:biz_type};
			this._getSchemeList(prams, header)
		},
		onShow() {
			if(this.isBack && this.isTxText == '是') {
				let userInfoData = uni.getStorageSync('userInfo');
				let header = {
					'content-type': 'application/x-www-form-urlencoded',
					'Authorization': userInfoData.token
				};
				let brandId = this.useBrands.brandId,carTypeId = this.useBrands.seriesId,
					carId = this.useBrands.carTypeId,
					loanTimeLimit = parseInt(this.dkqsText),
					identityNo = this.gouchedaiData.idcard,
					enterprise_id = this.gouchedaiData.enterprise_id;
				let prams = {brandId, carTypeId, carId, loanTimeLimit, identityNo, enterprise_id};
				this._getCarDiscountinterest(prams, header);
			}
		},
		methods: {
			/**
			 * 选择车辆
			 * @method carSelect
			 * @param {*} event
			 */
			carSelect() {
				uni.navigateTo({ url: '/pages/chengyongche/brands/brands' })
			},
			onInput(e) {
				let inputName = e.currentTarget.dataset.name;
				let inputVal = e.detail.value;
				console.log(e)
				this[inputName] = inputVal
				let _this = this;
				if(inputName == 'cjje' || inputName == 'sfje') {
					if(_this.sffsText == '按比例支付') {
						let sfbl = parseInt(_this.sfblText)
						let jkamount = inputVal - inputVal*(sfbl/100);
						_this.jkamount = jkamount.toFixed(2)
					}else if(_this.sffsText == '按定额支付') {
						let cjje = _this.cjje;
						let sfje = _this.sfje;
						let jkamount = cjje - sfje;
						_this.jkamount = jkamount.toFixed(2)
					}else {
						let jkamount = 0;
						_this.jkamount = jkamount.toFixed(2)
					}
				}
			},
			/**
			 * 是否新能源选择
			 * @method isEvSelect
			 * @param {*} event
			 */
			isEvSelect(e) {
				const _this = this;
				const isEvIndex = e.target.value;
				const isEvText = _this.isEvList[isEvIndex];
				if (isEvIndex >= 0) {
					_this.isEvIndex = isEvIndex;
					_this.isEvText = isEvText;
				}
			},
			/**
			 * 首付方式选择
			 * @method sfblSelect
			 * @param {*} event
			 */
			sffsSelect(e) {
				const _this = this;
				const sffsIndex = e.target.value;
				const sffsText = _this.sffsList[sffsIndex];
				if (sffsIndex >= 0) {
					_this.sffsIndex = sffsIndex;
					_this.sffsText = sffsText;
				}
			},
			/**
			 * 首付比例选择
			 * @method sfblSelect
			 * @param {*} event
			 */
			sfblSelect(e) {
				const _this = this;
				const sfblIndex = e.target.value;
				const sfblText = _this.downRatioList[sfblIndex];
				const sfblTextNumber = parseInt(sfblText);
				if (sfblIndex >= 0) {
					let cjje = _this.cjje;
					let sfbl = parseInt(sfblText)
					let jkamount = cjje - cjje*(sfbl/100);
					_this.sfblIndex = sfblIndex; _this.sfblText = sfblText; _this.jkamount = jkamount;
				}
			},
			/**
			 * 贷款期数选择
			 * @method dkqsSelect
			 * @param {*} event
			 */
			dkqsSelect(e) {
				const _this = this;
				const dkqsIndex = e.target.value;
				const dkqsText = _this.periodsList[dkqsIndex];
				const dkqsTextNumber = parseInt(dkqsText);
				if(dkqsIndex >= 0) {
					_this.dkqsIndex = dkqsIndex; this.dkqsText = dkqsText;
					if(_this.biz_type == 7 && _this.isTxText == '是') {
						let brandId = _this.useBrands.brandId,carTypeId = _this.useBrands.seriesId,
							carId = _this.useBrands.carTypeId,
							loanTimeLimit = dkqsTextNumber,
							identityNo = _this.userInfoData.idcard,
							enterprise_id = _this.userInfoData.idEnterpise;
						let prams = {brandId, carTypeId, carId, loanTimeLimit, identityNo, enterprise_id};
						_this._getCarDiscountinterest(prams, _this.header);
					}
				}
			},
			/**
			 * 是否贴息选择
			 * @method isTxSelect
			 * @param {*} event
			 */
			txShowToast() {
				if (!this.useBrands.carTypeId) {
					uni.showToast({
						icon: 'none',
						title: "请选择车辆信息",
						duration: 3000
					});
					return;
				}
				if (this.dkqsText == "请选择贷款期数") {
					uni.showToast({
						icon: 'none',
						title: "请选择贷款期数",
						duration: 3000
					});
					return;
				}
			},
			isTxSelect(e) {
				const _this = this;
				const isTxIndex = e.target.value;
				const isTxText = _this.isTxList[isTxIndex];
				if(isTxIndex !== "") _this.isTxIndex = isTxIndex; _this.isTxText = isTxText;
				if(isTxText == "否") _this.showTxList = false;
				if(isTxText == "是") {
					// let brandId = _this.useBrands.brandId,carTypeId = _this.useBrands.seriesId,
					// 		carId = _this.useBrands.carTypeId,
					// 		loanTimeLimit = parseInt(_this.dkqsText),
					// 		identityNo = _this.userInfoData.idcard,
					// 		enterprise_id = _this.userInfoData.idEnterpise;
					let brandId = "36",carTypeId = "33256",
					    carId = "1357918",
					    loanTimeLimit = "36",
					    identityNo = "110101198508090013",
					    enterprise_id = _this.userInfoData.idEnterpise;
					let prams = {brandId, carTypeId, carId, loanTimeLimit, identityNo, enterprise_id};
					_this._getCarDiscountinterest(prams, _this.header);
					_this.showTxList = true
				}
			},
			/**
			 * 贴息方案选择
			 * @method txfaSelect
			 * @param {*} event
			 */
			txfaSelect(e) {
				const _this = this;
				const txfaIndex = e.target.value;
				const txfaText = _this.txfaList[txfaIndex];
				if(txfaIndex >= 0) _this.txfaIndex = txfaIndex; _this.txfaText = txfaText;
			},
			nextBtn() {
				let gouchedaiData = this.gouchedaiData;
				let thisDt = this;
				let enterpiseId = gouchedaiData.enterprise_id, // 经销商id
					saleId = gouchedaiData.saleId,// 销售id
					sellName = gouchedaiData.sellName,// 销售姓名
					brandName = thisDt.useBrands.brandName,// 品牌名称
					brandId = thisDt.useBrands.brandId,// 品牌id
					carTypeName = thisDt.useBrands.seriesName,// 车系名称
					carTypeId = thisDt.useBrands.seriesId,// 车系id
					carName = thisDt.useBrands.carTypeName,// 车型名称
					carId = thisDt.useBrands.carId,// 车型id
					logo = thisDt.useBrands.carImg,// 品牌logo图片地址
					energy = thisDt.isEvIndex,// 是否新能源（0-否，1-是）
					transaction_price = thisDt.cjje,// 成交价
					down_method = thisDt.sffsText,// 首付方式
					down_ratio = thisDt.sfblText,// 首付比例
					down_amount = thisDt.sfje,// 首付金额
					periods = thisDt.dkqsText,// 期数
					discount_status = thisDt.isTxText,//  是否贴息
					discount_name = '',//  贴息方案
					txfaIndex = thisDt.txfaIndex,
					sysUniqueNo = '',
					biz_type = thisDt.gouchedaiData.biz_type,// 业务类型 
					repayment = '等额本息',// 还款方式（默认等额本息）
					loan_amount = thisDt.jkamount,// 借款金额
					additionalRate = thisDt.additionalRate, // 车主附加贷利率
					additionalAmt = thisDt.additionalAmt * 1; // 车主附加贷金额
				additionalRate = additionalRate + '';
				let priceIndex = additionalRate.indexOf(".") + 1;
				let priceCount = additionalRate.length - priceIndex;
				discount_status == "是" ? sysUniqueNo = thisDt.txfaOldList[txfaIndex].sysUniqueNo : sysUniqueNo = undefined
				discount_status == "是" ? discount_name = thisDt.txfaText : discount_name = undefined
				if(down_method == "按比例支付") down_amount = undefined
				if(down_method == "按定额支付") down_ratio = undefined
				if(carTypeId == "" || carTypeId == undefined || carTypeId == null) {
					uni.showToast({
						icon: 'none',
						title: "请选择车辆信息",
						duration: 3000
					});
				}else if(this.isEvText == '请选择是否为新能源车型') {
					uni.showToast({
						icon: 'none',
						title: "请选择是否新能源",
						duration: 3000
					});
				}else if(transaction_price == '') {
					uni.showToast({
						icon: 'none',
						title: "请输入成交金额",
						duration: 3000
					});
				}else if(this.integerFn(transaction_price)) {
					uni.showToast({
						icon: 'none',
						title: "成交金额只能输入100的倍数",
						duration: 3000
					});
				}else if(biz_type == 9 && additionalAmt == 0) {
					uni.showToast({
						icon: 'none',
						title: "请输入附加贷金额",
						duration: 3000
					});
				}else if(biz_type == 9 && additionalAmt > 100000) {
					uni.showToast({
						icon: 'none',
						title: "附加贷金额不能大于10万元",
						duration: 3000
					});
				}else if(biz_type == 9 && additionalRate == '') {
					uni.showToast({
						icon: 'none',
						title: "请输入附加贷利率",
						duration: 3000
					});
				}else if(biz_type == 9 && priceCount != 4) {
					uni.showToast({
						icon: 'none',
						title: "附加贷利率格式为四位小数",
						duration: 3000
					});
				}else if(down_method == '请选择首付方式') {
					uni.showToast({
						icon: 'none',
						title: "请选择首付方式",
						duration: 3000
					});
				}else if(down_method == "按比例支付" && down_ratio == '请选择首付比例') {
					uni.showToast({
						icon: 'none',
						title: "请选择首付比例",
						duration: 3000
					});
				}else if(down_method == "按定额支付" && down_amount == '') {
					uni.showToast({
						icon: 'none',
						title: "请输入首付金额",
						duration: 3000
					});
				}else if(down_method == "按定额支付" && this.integerFn(down_amount)) {
					uni.showToast({
						icon: 'none',
						title: "首付金额只能输入100的倍数",
						duration: 3000
					});
				}else if(periods == '请选择贷款期数') {
					uni.showToast({
						icon: 'none',
						title: "请选择贷款期数",
						duration: 3000
					});
				}else if(biz_type == 7 && discount_status == '请选择是否贴息') {
					uni.showToast({
						icon: 'none',
						title: "请选择是否贴息",
						duration: 3000
					});
				}else if(biz_type == 7 && discount_status == '是' && discount_name == '请选择贴息方案') {
					uni.showToast({
						icon: 'none',
						title: "请选择贴息方案",
						duration: 3000
					});
				}else if(down_method == "按定额支付" && ((transaction_price * 1) < (down_amount * 1))) {
					uni.showToast({
						icon: 'none',
						title: "首付金额不能大于成交金额",
						duration: 3000
					});
				}else if(loan_amount > (transaction_price * 0.85)) {
					uni.showToast({
						icon: 'none',
						title: "借款金额不能大于成交金额的85%",
						duration: 3000
					});
				}else if(biz_type == 9 && (additionalAmt + loan_amount) > transaction_price) {
					uni.showToast({
						icon: 'none',
						title: "附加贷金额和借款金额之和不能超过成交金额",
						duration: 3000
					});
				}else if(biz_type == 9 && additionalAmt > (transaction_price*0.15)) {
					uni.showToast({
						icon: 'none',
						title: "附加贷金额不能超过成交金额的15%",
						duration: 3000
					});
				}else {
					const siteUserId = thisDt.userInfoData.mobile;
					let prams = {};
					if(biz_type == 7) prams = {siteUserId, enterpiseId, saleId, brandName, brandId, carTypeName, carTypeId, carName, carId, logo, energy, transaction_price, down_method, down_ratio: parseInt(down_ratio), down_amount, periods: parseInt(periods), repayment, discount_status, biz_type, sysUniqueNo, discount_name, loan_amount};
					if(biz_type == 8) prams = {siteUserId, enterpiseId, saleId, brandName, brandId, carTypeName, carTypeId, carName, carId, logo, energy, transaction_price, down_method, down_ratio: parseInt(down_ratio), down_amount, periods: parseInt(periods), repayment, biz_type, loan_amount};
					if(biz_type == 9) prams = {additionalRate, additionalAmt, siteUserId, enterpiseId, saleId, brandName, brandId, carTypeName, carTypeId, carName, carId, logo, energy, transaction_price, down_method, down_ratio: parseInt(down_ratio), down_amount, periods: parseInt(periods), repayment, biz_type, loan_amount};
					this._createOrder(prams, thisDt.header);
				}
			},
			integerFn(val) {
				return !(/\d/.test(val) && val % 100 == 0);
			},
			navigateBack() {
				uni.navigateBack();
			},
			// -----------------------网络请求--------------------------
			_getSchemeList(prams, header) {
				getSchemeList(JSON.stringify(prams), header).then(res => {
					const data = res.data;
					if(data.resultCode != "0000") {
						uni.showToast({
							icon: 'none',
							title: res.data.resultMsg,
							duration: 3000
						});
					}else {
						let gouchedaiData = this.gouchedaiData;
						const downRatioList = data.data.downRatioList; // 首付比例
						const downRatioListNew = [];
						let sfblText = gouchedaiData.down_ratio;
						let newSfblText = sfblText;
						if(!sfblText) {sfblText = '请选择首付比例'}
						else {sfblText = sfblText+'%'}
						let sfblIndex = 0;
						for(let i = 0; i < downRatioList.length; i++) {
							downRatioListNew.push(downRatioList[i]+'%')
							if(downRatioList[i] == newSfblText) {
								sfblIndex = i;
							}
						}
						const periodsList = data.data.periodsList; // 贷款期数
						const periodsListNew = [];
						let dkqsText = gouchedaiData.periods;
						let dkqsIndex = 0;
						for(let i = 0; i < periodsList.length; i++) {
							periodsListNew.push(periodsList[i]+'期')
							if(periodsList[i] == dkqsText) {
								dkqsIndex = i;
							}
						}
						this.downRatioList = downRatioListNew; this.sfblIndex = sfblIndex; 
						this.sfblText = sfblText; this.periodsList = periodsListNew;
						this.dkqsIndex = dkqsIndex; this.dkqsText = dkqsText;
						uni.hideLoading();
					}
				}).then(res => {
					if(this.gouchedaiData.biz_type == 7 && this.isTxText == '是') {
						let brandId = this.useBrands.brandId,carTypeId = this.useBrands.seriesId,
							carId = this.useBrands.carTypeId,
							loanTimeLimit = parseInt(this.dkqsText),
							identityNo = this.gouchedaiData.idcard,
							enterprise_id = this.enterpiseId;
						// let brandId = "36",carTypeId = "33256",
						//     carId = "1357918",
						//     loanTimeLimit = "36",
						//     identityNo = "110101198508090013",
						//     enterprise_id = this.data.enterpiseId;
						let prams = {brandId, carTypeId, carId, loanTimeLimit, identityNo, enterprise_id};
						this._getCarDiscountinterest(prams, this.header);
					}
				}).catch(err => {
					uni.hideLoading();
				})
			},
			_createOrder(prams, header) {
				let _this = this;
				uni.showLoading();
				createOrder(JSON.stringify(prams), header).then(res => {
					const data = res.data;
					if(data.resultCode != "0000") {
						uni.showToast({
							icon: 'none',
							title: res.data.resultMsg,
							duration: 3000
						});
						uni.hideLoading();
					}else {
						const orderId = data.data.orderId;
						let unfinished = prams;
						unfinished["orderId"] = orderId;
						uni.setStorage({
							key: 'unfinished',
							data: unfinished,
							success: function() {
								uni.hideLoading();
								_this.isBack = false
								uni.navigateTo({ url: '../personal-information/personal-information?orderId='+orderId });
							}
						});
					}
				}).catch(err => {
					_this.isBack = false
					uni.hideLoading();
				})
			},
			_getCarDiscountinterest(prams, header) {
				getCarDiscountinterest(JSON.stringify(prams), header).then(res => {
					const data = res.data;
					if(data.resultCode != "0000") {
						uni.showToast({
							icon: 'none',
							title: res.data.resultMsg,
							duration: 3000
						});
					}else {
						let gouchedaiData = this.gouchedaiData;
						let txfaOldList = data.data.list;
						let txfaList = []
						let sysUniqueNo = gouchedaiData.sysUniqueNo;
						let txfaIndex = 0;
						let txfaText = '请选择贴息方案';
						for(let i = 0; i < txfaOldList.length; i++) {
							txfaList.push(txfaOldList[i].carTypeName)
							if(txfaOldList[i].sysUniqueNo == sysUniqueNo) {
								txfaIndex = i;
								txfaText = txfaOldList[i].carTypeName
							}
						}
						this.txfaList = txfaList; this.txfaIndex = txfaIndex; this.txfaText = txfaText; this.txfaOldList = txfaOldList;
						uni.hideLoading();
					}
				}).catch(err => {
					uni.hideLoading();
				})
			},
		}
	}
</script>

<style>
	@import url("./confirmation2.css");
</style>
